function Messagebox(msg, title,box){
    var $box = box||$('#MessageBox');
    $box.find('.modal-title').html(title);
    $box.find('.modal-body').html(msg);
    $box.modal();
    return $box;
}

function ShowMessage(msg,callback,box){
    var $box=Messagebox(msg, "提示",box);
    if(callback!=null){
        $box.find(".modal-footer button").click(function(){
            $box.modal('hide');
            callback();
        })
    }
    return $box;
}

function ErrMessage(msg,box){
    return Messagebox(msg, "错误",box);
}

function DeleteMessage(deleteUrl,data,callback,box){
    var $box = box||$('#delete');
    $box.modal();

    $box.find(".modal-footer button:last").unbind("click").click(function(){
        $box.modal('hide');
        var othis=this;
        $(othis).prop("disabled",true);
        AsyncPost(deleteUrl,data,function(value){
            if(value.code==0){
                ShowMessage(value.msg,callback);
            }else{
                ErrMessage(value.msg);
            }
            $(othis).prop("disabled",false);
        })
    })
    return $box;
}